package util;

import org.springframework.util.DigestUtils;

import java.io.UnsupportedEncodingException;

/**
 * The type Md 5 util.
 */
public class  Md5Util {

    /**
     * Encrypt to md 5 string.
     *
     * @param str the str
     * @return the string
     */
    public static String encryptToMD5(String str) {
        String MD5 = "";
        try {
            MD5 = DigestUtils.md5DigestAsHex(str.getBytes("utf-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return MD5;
    }
}
